﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Nova_DAL;
using Nova_Common;
using System.Data.Common;

public partial class DelStorage_DelDataListPOP : System.Web.UI.Page
{
    DbHelper access = new DbHelper();
    DbCommand cmd = null;
    DataSet ds = null;
    string strSQL = "";
    int i = 0;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            gvbind();
        }
    }


    protected void gvbind()
    {
        string WCode = Request.Cookies["WType"].Value;

        //strSQL = @"Select  distinct TDS.StockNo,TDS.Bill_Status,TDS.CDT from TBill_DelStorage as TDS 
        //LEFT JOIN TDelStorage_List AS TDL ON TDS.STOCKNO=TDL.STOCKNO WHERE TDS.BILL_STATUS='0' 
        //AND TDL.DynamicState01 IS NULL AND (TDL.TS02='" + WCode + "' or 'FSSC'='" + WCode + "') Order BY CDT Desc";

        strSQL = @"Select distinct TDS.StockNo,TDS.Bill_Status,TDS.CDT from TBill_DelStorage as TDS 
        LEFT JOIN TDelStorage_List AS TDL ON TDS.STOCKNO=TDL.STOCKNO WHERE TDS.BILL_STATUS='0' 
        AND TDL.DynamicState01 IS NULL Order BY CDT Desc";
        cmd = access.GetSqlStringCommond(strSQL);
        gv.DataSource = access.ExecuteDataSet(cmd);
        gv.DataBind();
    }

    protected void ibtnSearch_Click(object sender, ImageClickEventArgs e)
    {
        gvbind();
    }

    protected void gv_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gv.PageIndex = e.NewPageIndex;
        gvbind();  //重新绑定GridView
    }
    protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Label LabStock_No = (Label)e.Row.Cells[1].FindControl("LabStock_No");

            //  e.Row.Attributes.Add("onclick", "parent.window.returnValue='aa," + LabStock_No.Text.Trim() + "," + e.Row.Cells[2].Text.Trim().Replace("&nbsp;", "") + "';parent.window.close();");
            e.Row.Attributes.Add("onclick", "window.parent.opener.document.getElementById('txtStorageNo').value='" + LabStock_No.Text.ToString() + "';parent.window.close();");

            //鼠标移动到每项时颜色交替效果   
            e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';this.style.color='#003399'");
            e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#6699FF';this.style.color='#8C4510'");

            //设置悬浮鼠标指针形状为"小手"   
            e.Row.Attributes["style"] = "Cursor:hand";
        }
    }
}
